package com.jd.mti.beetl.test.load;

import com.jd.mti.beetl.test.controller.RenderController;

import java.util.*;

/**
 * @Author sizegang
 * @Date 2021/11/14 20:31
 * @Version 1.0
 */
public class LoadPare {

    public static Map testData() {
        Map<String, Object> obj = new HashMap<>();
        List<DataMan> renderList1 = new ArrayList<>();
        List<DataMan> renderList2 = new ArrayList<>();
        List<DataMan> renderList3 = new ArrayList<>();
        Random random = new Random();

        for (int i = 1; i < 10000; i++) {

            if (i < 5000) {
                insertData(renderList1, random, i);
            } else if (i >= 5000 && i < 10000) {
                insertData(renderList2, random, i);
            } else {
                insertData(renderList3, random, i);
            }
        }
        obj.put("render1", renderList1);
        obj.put("render2", renderList2);
        obj.put("render3", renderList3);
        return obj;
    }

    private static void insertData(List<DataMan> renderList1, Random random, int i) {
        int age = random.nextInt(i);
        DataMan dataMan = new DataMan(String.valueOf(age) + "-name", age);
        renderList1.add(dataMan);
    }
}
